home *** CD-ROM | disk | FTP | other *** search
/ Magnum One / Magnum One (Mid-American Digital) (Disc Manufacturing).iso / d12 / c_toolbx.arc / DOCCREAT.C < prev    next >
Encoding:
C/C++ Source or Header  |  1988-03-30  |  959 b   |  50 lines

  1. /*  doccreat.c - creat a document index and data file */
  2. #include   "stdio.h"
  3. #include   "cminor.h"
  4. #include   "btree.h"
  5. #include   "bt_macro.h"
  6.  
  7. #define WR_MODE  1            /* write access for open */
  8. extern ENTRY dume ;
  9. extern    int ndum ;
  10.  
  11. main(argc,argv)
  12.   int    argc ;
  13.   char    *argv[] ;
  14.   {
  15.      int   ret ;
  16.      char  fn[65] ;
  17.      RECPOS fs ;
  18.  
  19.      if( argc < 3 )
  20.     { printf(" USAGE: - doccreat doc-file-name file_size \n") ;
  21.       exit(5) ;
  22.     }
  23.  
  24.      add_str(fn,argv[1],".idx",&fs) ;
  25.  
  26.      ret = sscanf(argv[2],"%1d",&fs) ;
  27.      if( (ret == 0) || (fs < 0) )
  28.     {  printf(" bad file size specification \n") ;
  29.        exit(6) ;
  30.     }
  31.  
  32.      if( creatix(fn,fs,&dume,ndum) < 0 )
  33.     {  printf(" can't create the index file \n") ;
  34.        exit(10) ;
  35.     }
  36.  
  37.      add_str(fn,argv[1],".dat") ;
  38.      ret = gcreat(fn,WR_MODE,BIN_MODE) ;
  39.      if( ret < 0 )
  40.     {  printf(" can't create the data file \n") ;
  41.        exit(12) ;
  42.     }
  43.      close(ret) ;
  44.   }
  45.  
  46.  
  47.  
  48.  
  49.  
  50.